Skip to content

Extract 'dsumEncoder' from chainEncoder#1000

Open
alexfmpe wants to merge 2 commits intoobsidiansystems:developfrom
alexfmpe:dependent-encoder
Open

Extract 'dsumEncoder' from chainEncoder#1000
alexfmpe wants to merge 2 commits intoobsidiansystems:developfrom
alexfmpe:dependent-encoder

Conversation

@alexfmpe
Copy link
Contributor

@alexfmpe alexfmpe commented Nov 12, 2022

I wanted to call it dependentEncoder since it exhibits a bit of context dependent parsing, but then there's the dependent sum aspect and the name would get confusing. While a dependent sum encoder must be ctx dependent, the converse is not true. We can get a simpler

  => Encoder check parse a a'
  -> (a -> Encoder Identity parse b b')
  -> Encoder check parse (a,b) (a', b')

by wrapping/unwraping via Const. I'm tempted to add such a util for convenience but am not coming up with a good name. Maybe contextDependentEncoder on account of it being the simpler such encoder?

I have:

  • Based work on latest develop branch
  • Followed the contribution guide
  • Looked for lint in my changes with hlint . (lint found code you did not write can be left alone)
  • Run the test suite: $(nix-build -A selftest --no-out-link)
  • Updated the changelog
  • (Optional) Run CI tests locally: nix-build release.nix -A build.x86_64-linux --no-out-link (or x86_64-darwin on macOS)

Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Copy link
Member

@ryantrinkle ryantrinkle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great; thanks!

@alexfmpe
Copy link
Contributor Author

Should I bundle a contextDependentEncoder with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants